{% extends "@PimNotification/Email/notification.html.twig" %}

{% block title %}
    Akeneo batch {{ jobExecution.jobInstance.type }}
{% endblock %}

{% block link %}
    <link href="https://fonts.googleapis.com/css?family=Lato:400,900" rel="stylesheet" type="text/css"/>
{% endblock %}

{% block head %}
    {{ parent() }}
    <style>
        @media only screen and (max-width: 500px) {
            #footerContainer {
                padding: 15px 50px;
            }
            #result {
                width: 90%;
            }
        }

        @media only screen and (min-width: 660px) {
            #result {
                width: 70%;
            }
        }
    </style>
{% endblock %}

{% block emailMessage %}
    <p style="margin: 0 0 30px 0; font-size: 20px; font-family: 'Lato', sans-serif">
        {% if jobExecution.status.unsuccessful %}
            Akeneo completed your "{{ jobExecution.jobInstance.label }}" job with errors.
        {% else %}
            Akeneo successfully completed your "{{ jobExecution.jobInstance.label }}" job.
        {% endif %}
    </p>
    <p style="margin: 0 0 20px 0; font-size: 12px;font-family: 'Lato', sans-serif">
        Started on {{ jobExecution.startTime|date("Y-m-d") }} at {{ jobExecution.startTime|date("H:i:s") }}.<br/>
        Ended on {{ jobExecution.endTime|date("Y-m-d") }} at {{ jobExecution.endTime|date("H:i:s") }}.
    </p>
    <div style="margin: auto; width: 80%; text-align: start; font-size: 12px;font-family: 'Lato', sans-serif"
         id="result">
        <p>Results:</p>
        <ul style="padding-left: 5px">
            {% for stepExecution in jobExecution.stepExecutions %}
                <li style="list-style-type: '- ';margin: 0">
                    {{ stepExecution.stepName|trans }} [{{ stepExecution.status }}]
                    {{ 0 < stepExecution.warnings|length ? 'With ' ~ stepExecution.warnings|length ~ ' warning(s)' : '' }}
                </li>
            {% endfor %}
        </ul>
    </div>
{% endblock %}

{% block emailUserAction %}
    {% if akeneo_pim_url is not empty %}
        <span>
            <a target="_blank"
               role="button"
               style="-webkit-appearance: button; -moz-appearance: button; appearance: auto;
               padding: 10px 20px; border-radius: 25px; background-color: #9452ba; color: white;
               text-decoration: none; text-transform: uppercase; font-size: 15px; font-weight: 900;"
               href="{{ akeneo_pim_url ~ '/#' ~ path('akeneo_job_process_tracker_details', {'id': jobExecution.id}) }}">View summary</a>
        </span>
    {% else %}
        <p style="margin: unset; font-size: 12px; font-style: italic;">
            You should set the AKENEO_PIM_URL environment variable to view summary.
        </p>
    {% endif %}
{% endblock %}
